package com.fr.data.core.db.handler;

import com.fr.data.core.db.dialect.Dialect;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class StringTypeHandler
  implements SQLTypeHandler
{
  public void setValue(PreparedStatement paramPreparedStatement, int paramInt1, Object paramObject, int paramInt2, Dialect paramDialect)
    throws SQLException
  {
    paramPreparedStatement.setString(paramInt1, paramObject + "");
  }

  public Object getValue(ResultSet paramResultSet, int paramInt1, int paramInt2, Dialect paramDialect)
    throws SQLException
  {
    String str;
    int i;
    if (paramInt2 == 1)
    {
      str = paramResultSet.getString(paramInt1);
      if (str != null)
        for (i = str.length() - 1; i >= 0; --i)
          if (str.charAt(i) > ' ')
            return str.substring(0, i + 1);
    }
    return paramResultSet.getString(paramInt1);
  }
}